package com.project;

import com.project.service.Handler;
import com.project.service.impl.ConcreteHandler1;
import com.project.service.impl.ConcreteHandler2;
import org.junit.Test;

public class ChainModel {

    public static void main(String[] args) {
        //组装责任链
        Handler handler1 = new ConcreteHandler1();
        Handler handler2 = new ConcreteHandler2();
        handler1.setNext(handler2);
        //提交请求
        handler1.handleRequest("two");
    }

    @Test
    public void cycleTest() throws InterruptedException {
        int i=0;
        while (true){
            System.out.println(i++);
            Thread.sleep(1000);
        }
    }
}
